package org.gis.mapserver.adapter;

import org.gis.mapserver.base.Disposable;
import org.gis.mapserver.source.Source;
import org.gis.mapserver.source.SourceType;

/**
 *
 * @author gus
 */
public abstract class SourceAdapter implements Disposable
{
    protected Source source;

    public SourceAdapter( Source source ) throws Exception
    {
        if(!isSupported(source.getSourceType()))
        {
            throw new Exception(String.format("adapter not supported type ", source.getClass()));
        }
        this.source = source;
    }

    public void dispose() throws Exception
    {
        source.dispose();
    }
    
    protected abstract boolean isSupported(SourceType type);
}
